﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace Royaume
{
    public partial class ucStat : System.Web.UI.UserControl
    {
        public SqlConnection myCn;
        protected SqlCommand myCmd;
        protected SqlDataReader myDr;

        protected void Page_Load(object sender, EventArgs e)
        {
            this.myCn = Connect.getconnectionstringG();
            this.myCn.Open();
            this.myCmd = new SqlCommand("spStats", this.myCn);
            //this.myCmd.CommandText = "spStats";
this.myCmd.CommandType = CommandType.StoredProcedure;
string pk = "0";
if (Session["pkUser"] != null)
{
    pk = Session["pkUser"].ToString();
}
            myCmd.Parameters.Add("@FkMembre", SqlDbType.Int).Value = pk;
            
            myDr = myCmd.ExecuteReader();
            TableRow rangee = new TableRow();
           while (myDr.Read()) {
                TableCell  ValCell= new TableCell();
                ValCell.Text = myDr[0].ToString();
                rangee.Cells.Add(ValCell);
                ValCell = new TableCell();
                ValCell.Text = myDr[1].ToString();
                rangee.Cells.Add(ValCell);
                ValCell = new TableCell();
                ValCell.Text = myDr[2].ToString();
                rangee.Cells.Add(ValCell);
                ValCell = new TableCell();
                ValCell.Text = myDr[3].ToString();
                rangee.Cells.Add(ValCell);

            }
            this.myCn.Close();
            Table1.Rows.Add(rangee);
        }
    }
}